<jsp:directive.page import="java.util.Date"/>
<%@ include file="/other/Header.jsp"%>
<%@ include file="/other/Date.jsp" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="java.sql.*"/>
<jsp:directive.page import="Connectivity.ConnectionManager"/>
 <%
 //Connection con=null;
String status = request.getParameter("status")!=null?request.getParameter("status"):"null";
String image_name = request.getParameter("image_name")!=null?request.getParameter("image_name"):"spacer.gif";
String path1 = "/container/images/";
String basePath1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path1+"/";
  Date d1=new Date();
String current_date=(d1.getDate()+"-"+(d1.getMonth()+1)+"-"+(d1.getYear()+1900));  
String current_year=""+(d1.getYear()+1900);

 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'ServiceCall.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
    <script language="javaScript" type="text/javascript" src="/other/data.js"></script>
    </head>
  <script>
  
  function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
  

function startCalc(){
  interval = setInterval("calc()",1);
}
function calc(){
  ta = document.serviceform.ta.value;
  fe = document.serviceform.fe.value;
  lodge = document.serviceform.lodge.value;
  other = document.serviceform.other.value;
   
  document.serviceform.total.value = (ta * 1) + (fe * 1) + (lodge * 1) + (other * 1);
}
function stopCalc(){
  clearInterval(interval);
}

 function chksel(obj)
  {
   if(document.serviceform.pfp1.checked)
   {document.getElementById("pfp").style.display="block";}
   else
   {document.getElementById("pfp").style.display="none";}   	
   	
    if(document.serviceform.mtaken1.checked)
    {document.getElementById("mtaken").style.display="block"; }
    else
   {document.getElementById("mtaken").style.display="none";}   	
   
    if(document.serviceform.mgiven1.checked)
    {document.getElementById("mgiven").style.display="block";}
    else
   {document.getElementById("mgiven").style.display="none";}   	
    
  } 
 
  function hiderow()
  {
  document.getElementById("mtaken").style.display="none";
  document.getElementById("mgiven").style.display="none";
  document.getElementById("pfp").style.display="none";
  }
  
//  history.forward(1); 
  </script>
  <body onload="chksel(1);">
  <script>doClock();</script>
     <form name=serviceform method=get action="/Genius/form/general/tmpService.jsp">
  <%
  // callentry_id=11$12&compalint_id=1GI532012&emp_id=3034&cust_id=179&item_name=TALLY%202250%20,<br>IBM
  String cust_id= request.getParameter("cust_id")!=null?request.getParameter("cust_id"):"-";
  String callentryno= request.getParameter("callentry_id")!=null?request.getParameter("callentry_id"):"";
  String complaint_id= request.getParameter("complaint_id")!=null?request.getParameter("complaint_id"):"";
  String emp_eid= request.getParameter("emp_id")!=null?request.getParameter("emp_id"):"";
  String item_name= request.getParameter("item_name")!=null?request.getParameter("item_name"):"";
  String items="",customer_name="-",call_lock_date="-",call_lock_time="-",call_details="-",employee_name="-";
//out.println(callentryno+"---"+emp_id+"---"+item_name+"---"+complaint_id);
try
{  if(complaint_id!=("") && emp_eid!=(""))
  { // out.println(callentryno+"---"+emp_id+"---"+item_name+"---"+complaint_id);
  ResultSet rs1=null;
CallableStatement cstmt = con.prepareCall("{?=call fun_retrieve_callassignedforservicecall(?,?,?)}");
			cstmt.registerOutParameter(1, Types.OTHER);
			cstmt.setString(2, complaint_id);
			cstmt.setInt(3,Integer.parseInt(cust_id));
			cstmt.setObject(4, rs1);
			
			con.setAutoCommit(false);
			cstmt.execute();
			
			

  
	 rs1= (ResultSet) cstmt.getObject(1);	
  while(rs1.next())
  {
  customer_name=rs1.getString(1).toUpperCase();
  cust_id=rs1.getString(2);
  call_lock_date=rs1.getString(3);
  call_lock_time=rs1.getString(4);
  call_details=rs1.getString(5).toUpperCase();
  employee_name=rs1.getString(6).toUpperCase();
StringTokenizer st1=new StringTokenizer(call_lock_date,"-");
while(st1.hasMoreTokens())
   {
   String call_year=st1.nextToken();
   String call_month=st1.nextToken();
   String call_date=st1.nextToken();
   
    call_lock_date=call_date+"-"+call_month+"-"+call_year;
  }
  }
   %>
    
   <table border=1 width=80%> 
   <!-- Label Service call report -->
  
   <tr> <td colspan=10 align=middle><font color=BLUE size=4>SERVICE CALL REPORT</font> </td> </tr>
   
   <!-- Label & value complaint Id and date selection  -->   
   <tr>
   <td colspan=5 align=middle>COMPLAINT ID&nbsp;:&nbsp;<u><%=complaint_id%></u></td>
   <td colspan=5 align=middle>DATE&nbsp;:&nbsp;<input type="text" name="servicedate"  id="sdate" readonly="readonly" value="<%=current_date%>"   >
   <img alt="click to select date" src="/Genius/images/calender.png"  style="cursor: hand; "   id="img3" onClick="setYears(2000, <%=current_year%>);showCalender(this, 'servicedate');">	
   </td>
   </tr>
 <!-- customers name with branch taken  -->
        <TR>
          <TD  colspan=5 align=right>CUSTOMER'S NAME&nbsp;:&nbsp;&nbsp;&nbsp; </TD>
          <TD  colSpan=5 align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><%=customer_name%></u></TD>
       </TR>
        <TR>
      
  <TR>
          <TD  colspan=5 align=right>NATURE OF FAULT&nbsp;:&nbsp;&nbsp;&nbsp; </TD>
          <TD  colSpan=5 align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><%=call_details%></u></TD>
       </TR>
        <TR>
      
      
     <tr>
     <td colspan=10 >
        <table border=1 width=100%>
        <tr>
           <td cospan=2>CALL DATE</td>
           <td cospan=2>CALL TIME</td>
           <td cospan=2>TYPE OF CALL</td>
           <td cospan=2>ITEM</td>
           <td cospan=2>ATTENDED BY</td>
         </tr>  
        <tr>
           <td cospan=2><%=call_lock_date%></td>
           <td cospan=2><%=call_lock_time%></td>
           <td cospan=2>
           <table border=1 width=100% >
           <tr><td colspan=1><input type ="checkbox" name=call_type value="PM"></td><td colspan=1>PM</td></tr>
           <tr><td colspan=1><input type ="checkbox" name=call_type value="ORC"></td><td colspan=1>ON REQUEST CALL</td></tr>
           </table>
           </td>
           <td cospan=2><%=item_name%></td>
           <td cospan=2><%=employee_name%></td>
         </tr>  
           
        
        
        </table>
       </td>
       </tr> 
      <!-- Label Action taken  -->
       <TR>
          <TD  colspan=4 align=right>ACTION TAKEN : </TD>
          <TD  colSpan=6 align=left bordercolor="to.UpperCase()"><TEXTAREA  rows=3 cols=50 name=ataken><%=call_details%></TEXTAREA> 
          </TD></TR>
        <TR>
      
      <!-- Label Action taken  -->
       <TR>
          <TD colspan=5  > 
          <input type="checkbox" name=mtaken1 value="mtaken" onclick="chksel(this)"> 
          MATERIAL TAKEN
          </TD>
          <TD colspan=5 >
          <input type="checkbox" name=mgiven1 value="mgiven" onclick="chksel(this)"> 
          MATERIAL GIVEN  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="checkbox" name=pfp1 value="pfp" onclick="chksel(this)"> PENDING FOR PARTS
                   </TD></TR>
        <TR>
      
      
      
      
      
      
       <!-- Label Action taken  -->
       <TR id=mtaken>
          <TD  colspan=4 align=right>
          	MATERIAL TAKEN: </TD>
          <TD  colSpan=6 align=left>
          <TEXTAREA  rows=2 cols=50 name=mtakendata ></TEXTAREA> 
          </TD></TR>
        <TR>
      
        
       <!-- Label Action taken  -->
       <TR id=mgiven>
          <TD  colspan=4 align=right>
          	MATERIAL GIVEN: </TD>
          <TD  colSpan=6 align=left>
          <TEXTAREA  rows=2 cols=50 name=mgivendata wrap="hard"></TEXTAREA> 
          </TD></TR>
        <TR>
      
       <!-- Label Action taken  -->
       <TR id=pfp>
          <TD  colspan=4 align=right>
          	PENDING FOR PARTS: </TD>
          <TD  colSpan=6 align=left>
          <TEXTAREA  rows=2 cols=50 name=pfpdata ></TEXTAREA> 
          </TD></TR>
        <TR>
      
            <!-- Label REMARK taken  -->
       <TR>
          <TD  colspan=4 align=right>REMARK : </TD>
          <TD  colSpan=6 align=left><TEXTAREA  rows=2 cols=50 name=remark></TEXTAREA> 
          </TD></TR>
      
      
        <TR>
        <td colspan=10>
        <table width=100% border=1>
          <tr >
          <td  colspan=2 align=middle><font size=2>TRAVELLING  </font></td>
          <td  colspan=2 align=middle>FOOD EXPENSE  </td>
          <td  colspan=2 align=middle>LODGE  </td>
          <td  colspan=2 align=middle>OTHER  </td>
          <td  colspan=2 align=middle>TOTAL  </td>
          </tr>
          
          <tr >
          <td  colspan=2 align=middle><input type= text size=11 onkeypress="return isNumberKey(event)" name=ta value="" onFocus="startCalc();" onBlur="stopCalc();"> </td>
          <td  colspan=2 align=middle><input type= text size=11 onkeypress="return isNumberKey(event)" name=fe value="" onFocus="startCalc();" onBlur="stopCalc();">   </td>
          <td  colspan=2 align=middle><input type= text size=11 onkeypress="return isNumberKey(event)" name=lodge value="" onFocus="startCalc();" onBlur="stopCalc();">   </td>
          <td  colspan=2 align=middle><input type= text size=11 onkeypress="return isNumberKey(event)" name=other value="" onFocus="startCalc();" onBlur="stopCalc();">   </td>
          <td  colspan=2 align=middle><input type= text size=11 name=total value="" readonly>   </td>
          </tr>
       
          
        
          
          
          
          </table>
        </td>
        </TR>
             
       <TR>
          <TD  colspan=5 align=right><input type=submit value="submit" name="submit"> </TD>
          <TD  colSpan=5 align=left><input type=reset value="reset" name="reset">
          </TD></TR>
      
      
        </table>  
      
    
     
  
   
   <%}
   }
   
   catch(Exception e){} %>
    </table>
<input type=hidden name=callentry_id value=<%=callentryno %>>
<input type=hidden name=complaint_id value=<%=complaint_id %>>
<input type=hidden name=emp_id value=<%=emp_eid%>>
<input type=hidden name=call_lock_date value=<%=call_lock_date%>>
<input type=hidden name=call_lock_time value=<%=call_lock_time%>>
<input type=hidden name=cust_id value=<%=cust_id%>>


  

   </form> 
   
   
  </body>
</html>
